import React from 'react';
import base64url from "base64url";
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { Icon, List, WhiteSpace, Badge} from 'antd-mobile';
import BG from '../../assets/mine/minBG.jpg';
import styles from './index.less';

import new1 from '../../assets/news/people.jpg';

const Item = List.Item;
const empty = require('is-empty');
class Mine extends React.Component{

  constructor(props){
    super(props);
    this.state={}
  }
  //点击头像
  checkPhoto = () =>{
    this.props.dispatch(
      routerRedux.push({
        pathname:"/work/myinformmation",
      })
    )
  };
  //跳转积分
  point = () =>{
    console.log('跳积分');
    this.props.dispatch(
      routerRedux.push({
        pathname:"/work/GRJF",
      })
    )
  };
  //跳转收藏
  collection = () =>{
    console.log('收藏');
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/collection",
      })
    )
  };
  //跳转任务
  toTask = () =>{
    console.log('renwu');
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/task",
      })
    )
  };
  // //跳转电子党建卡
  // myCard= () =>{
  //   console.log('card');
  //   this.props.dispatch(
  //     routerRedux.push({
  //       pathname:"/selfinfo/mycard",
  //     })
  //   )
  // };
  // //跳转我管理的网站
  // myWeb = () =>{
  //   console.log('web');
  //   this.props.dispatch(
  //     routerRedux.push({
  //       pathname:"/selfinfo/myweb",
  //     })
  //   )
  // };
  //跳转我的活动
  myActivity = () =>{
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/myactivity",
      })
    )
  };
  //跳转我的课程
  MyCourse = () =>{
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/mycourse",
      })
    )
  };
  //跳转我的发布
  MyRelease = () =>{
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/myrelease",
      })
    )
  };
  //跳转我的设置
  myset = () =>{
    this.props.dispatch(
      routerRedux.push({
        pathname:"/selfinfo/myset",
      })
    )
  };

  render(){
    const {name, position, lv} =this.props.mine;
    console.log(name,position,lv,'ssssssssssssssssssssss')

    let WebNum=3; //管理的网站

    return(
      <div>
        <div className={styles.top} style={{background:'#ff0000'}}>
          <div style={{height:'2.5rem',width:'80%',margin:'0 auto',marginTop:'10%',overflow: 'hidden'}} onClick={this.checkPhoto}>
            <div className={styles.touxiang} >
              <img src={new1} alt="" style={{width: '100%',height: '2rem', overflow: 'hidden'}}/>
            </div>
            <div className={styles.info}>
              <div style={{fontSize:'0.6rem',marginBottom:'0.2rem'}}>{name}</div>
              <div style={{marginBottom:'0.2rem'}}>{position}</div>
              <div>
                <Badge text={`LV ${lv}`} style={{backgroundColor: '#FFC61A'}} />
              </div>
            </div>
          </div>
          <div>
            <div className={styles.detalsInfo} onClick={this.point}>
              <div style={{fontSize:'0.45rem'}}>965</div>
              <div style={{fontSize:'0.3rem'}}>总积分</div>
            </div>
            <div className={styles.detalsInfo} onClick={this.collection}>
              <div style={{fontSize:'0.45rem'}}>965</div>
              <div style={{fontSize:'0.3rem'}}>收藏</div>
            </div>
            <div className={styles.detalsInfo2} onClick={this.toTask}>
              <div style={{fontSize:'0.45rem'}}>965</div>
              <div style={{fontSize:'0.3rem'}}>任务</div>
            </div>
          </div>
        </div>

        <WhiteSpace size="xl" />

          {/*<List className="my-list">*/}
            {/*<Item extra={'查看'} arrow="horizontal" onClick={this.myCard}>*/}
              {/*<span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/bankCard.svg`)} />&nbsp;&nbsp;我的电子党建卡</span>*/}
            {/*</Item>*/}
            {/*<Item extra={`${WebNum}`} arrow="horizontal" onClick={this.myWeb} >*/}
              {/*<span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/myWeb.svg`)} />&nbsp;&nbsp;我管理网站</span>*/}
            {/*</Item>*/}
          {/*</List>*/}

        <WhiteSpace size="lg" />

        <List className="my-list">
          <Item extra={'查看'} arrow="horizontal" onClick={this.MyRelease}>
            <span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/mySend.svg`)} />&nbsp;&nbsp;我的发布</span>
          </Item>
          <Item extra={`${WebNum}`} arrow="horizontal" onClick={this.MyCourse}>
            <span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/myClass.svg`)} />&nbsp;&nbsp;我的课程</span>
          </Item>
          <Item extra={`${WebNum}`} arrow="horizontal" onClick={this.myActivity} >
            <span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/myActivity.svg`)} />&nbsp;&nbsp;我的活动</span>

          </Item>
        </List>

        <WhiteSpace size="lg" />

        <List className="my-list">
          <Item arrow="horizontal" onClick={this.myset}>
            <span className={styles.iconPosition1}><Icon size="md"  type={require(`../../svgs/mine/set.svg`)} />&nbsp;&nbsp;设置</span>
          </Item>
        </List>
        <div style={{marginTop:'1.5rem'}}></div>
      </div>
    )
  }
}

function mapStateToProps({mine}) {
  return {mine}
}
export default connect(mapStateToProps)(Mine);
